#pragma once
#include"public_struct.h"
//bfs
vector<vector<int>> levelOrderBottom(TreeNode* root) {
	vector<vector<int>> result;
	if (!root)return result;
	queue<TreeNode*> q;
	q.push(root);
	while (!q.empty()) {
		vector<int> temp;
		int size = q.size();
		while (size-- > 0) {
			TreeNode* temp_T = q.front();
			q.pop();
			if (temp_T->left) { q.push(temp_T->left); }
			if (temp_T->right) { q.push(temp_T->right); }
			temp.push_back(temp_T->val);
		}
		result.push_back(temp);
	}
	reverse(result.begin(), result.end());
	return result;
}



